package com.haoshuang.zhouzhoubang.ui.dialog

import android.content.Context
import com.haoshuang.zhouzhoubang.R
import com.haoshuang.zhouzhoubang.databinding.DialogChooseMediaTypeBinding
import com.lxj.xpopup.core.BottomPopupView
import com.lxj.xpopup.core.CenterPopupView
import com.mufeng.libs.utils.view.click
import com.mufeng.libs.utils.view.clickWithTrigger

/**
 * 
 */
class ChooseMediaTypeDialog(context: Context, private val onChooseType: (type: Int) -> Unit): BottomPopupView(context) {

    private lateinit var binding: DialogChooseMediaTypeBinding

    override fun getImplLayoutId(): Int {
        return R.layout.dialog_choose_media_type
    }

    override fun onCreate() {
        super.onCreate()
        binding = DialogChooseMediaTypeBinding.bind(popupImplView)
        binding.apply{
            psTvCancel.clickWithTrigger { dismiss() }
            psTvPhoto.clickWithTrigger {
                dismiss()
                onChooseType(0)
            }
            psTvVideo.clickWithTrigger {
                dismiss()
                onChooseType(1)
            }
        }
    }
}